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

Query time 0.00135