UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D5anQ7sGuUkrbiYvDAQwJhCLcc24mROMYvQ4cwK7dBE='
WHERE
key_id = 'be49529b1f71e5d2888d03f7718dcd5818ae3d81d28d8f83f8da3a0de4f5db49'
AND (
token = 'D5anQ7sGuUkrbiYvDAQwJhCLcc24mROMYvQ4cwK7dBE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)