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