UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fn4U8oC2jeR2g0B9ukgN9W9HSV9H7YNLkwg645XGEK4='
WHERE
key_id = 'd1c42eee303c934d9797b8ed2d0a1bb5b7539c02851523844bd6773cbd8b2158'
AND (
token = 'fn4U8oC2jeR2g0B9ukgN9W9HSV9H7YNLkwg645XGEK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)