UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N+h2juw1A33qd72vMLXU4SNNY9KImIr9+lM7DjetInw=' 
WHERE 
  key_id = '7acb80215f28788152f3dde6659ab822986d58274ec54278ee08c8c3736f718e' 
  AND (
    token = 'N+h2juw1A33qd72vMLXU4SNNY9KImIr9+lM7DjetInw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033