UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qgtdtyWbeHCr00/vYBWecwqLTpDdwgUQgBmAptbZda8='
WHERE
key_id = 'b5df3c8c58cdbbed12f440a75bdee7953a63e3d339c5586121be6e6d792b72b0'
AND (
token = 'qgtdtyWbeHCr00/vYBWecwqLTpDdwgUQgBmAptbZda8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)