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