UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nTqiUSqxz+pam34nHYWZ4iG5ZLrUK613kqPjWDTGudU='
WHERE
key_id = '5983b8762bd31be273cd13a19fa424ed2422f19537956e8a1e0625f1c719130a'
AND (
token = 'nTqiUSqxz+pam34nHYWZ4iG5ZLrUK613kqPjWDTGudU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)