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