UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yKmLxlsQi5ABGqAb5oExNCQIWRkq0kE8ngYbzEL0D5k=' 
WHERE 
  key_id = '865ade406056fe2163142e5f7c34e8d478cb6c8f479801b7136b675f310e144b' 
  AND (
    token = 'yKmLxlsQi5ABGqAb5oExNCQIWRkq0kE8ngYbzEL0D5k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041