UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VRApgful5JwgVdUM2lzx9Tk2PbK0I5iyI+rKXuS8Dz4='
WHERE
key_id = '6ea44f9f47b86984e7a05e864601e902fb2ba6700960ee690e3c829504821d52'
AND (
token = 'VRApgful5JwgVdUM2lzx9Tk2PbK0I5iyI+rKXuS8Dz4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)