UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fXdNnh0aq+YyhQI8MYntHLxaKwq1n6z4El6LgZcCanQ='
WHERE
key_id = 'd685dcbcdb60bf808bde453820bbd27cdb80bd1a0c0d49dcc205bbdc36406b24'
AND (
token = 'fXdNnh0aq+YyhQI8MYntHLxaKwq1n6z4El6LgZcCanQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)