UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p4kowbUEBlE8/ZB3yPpNomKM+4n/JRjsfU2BYg0Gky4=' 
WHERE 
  key_id = '963de22ddc96eb77001fc7324ad63b6bacd81daab1c74aa03c3ac9a852271933' 
  AND (
    token = 'p4kowbUEBlE8/ZB3yPpNomKM+4n/JRjsfU2BYg0Gky4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034