UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SCgcHnqiQMDEXC152tPobdY8zVfMIEyimfS4+6OwnL8='
WHERE
key_id = '6b0cc61c419614e8f90b93811b76bef1c0283777fd41493fbe3980d35f899326'
AND (
token = 'SCgcHnqiQMDEXC152tPobdY8zVfMIEyimfS4+6OwnL8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)