UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q8kvsry3D6hrlOkeFRIQOYlxfK38XTjidum18iw3BNI='
WHERE
key_id = '9e13e5ad439c369090ed5af163c0ab1d9a565a286bc45b9698b6c41ae0a494d8'
AND (
token = 'q8kvsry3D6hrlOkeFRIQOYlxfK38XTjidum18iw3BNI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)