UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HPCp31hB6vupk851fytMlaS99FF8AL1mYVW8+ylIiow='
WHERE
key_id = 'ea4614cfbd407494be438ccbe0e7b1d52dfc368945037b0f800861d3a62f2632'
AND (
token = 'HPCp31hB6vupk851fytMlaS99FF8AL1mYVW8+ylIiow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)