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