UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0eB6fMWORksVuIHea6FSduF0L1U9KplepaWi5nOlrh0='
WHERE
key_id = 'e114323c94c2d8546e68960d0c0455e50f867f80761f6187a5fd76bf94fec2cf'
AND (
token = '0eB6fMWORksVuIHea6FSduF0L1U9KplepaWi5nOlrh0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)