UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oH4f9ObhvXcZEwKa2I4Tsc1rRIqANxSXDxiJMGpCkbg='
WHERE
key_id = '7afd8a62746899d451165fe51ee4bdf8525ad87351ef189fd392ed1c35978cb3'
AND (
token = 'oH4f9ObhvXcZEwKa2I4Tsc1rRIqANxSXDxiJMGpCkbg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)