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