UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aO5RM7eYeHb/ag5ZSb7pjzCcjH83GY27u8t6SVTjxX4=' 
WHERE 
  key_id = 'a34e6212fed94df9b8997cce889dc1cc6eba46443620256f2cef27b92c6478f8' 
  AND (
    token = 'aO5RM7eYeHb/ag5ZSb7pjzCcjH83GY27u8t6SVTjxX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039