UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8qZJ4Gx1bEckv1GPeiNT7GEWsPloT0thY1rgYxRYgX0='
WHERE
key_id = 'aec4f3745cbce91cda0c58992a15a9e2b565f74952011c076b7620d4bc2d97ed'
AND (
token = '8qZJ4Gx1bEckv1GPeiNT7GEWsPloT0thY1rgYxRYgX0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)