UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N50Apy0awW1DsA2zapO2yXFUEvrYXrlm+7n11vnwnLA='
WHERE
key_id = '41b20256055a72d0416c6771985318372f670a96d29118ba37c1b0b66da12cdc'
AND (
token = 'N50Apy0awW1DsA2zapO2yXFUEvrYXrlm+7n11vnwnLA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)