UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lg+KSzlI/QvR1GRjlkXQObMzPXEb2GNfxp+EiZ7Pbuw=' 
WHERE 
  key_id = '554a0ef55877b0eff53445d2c3831082b7d030335bb94d4b40d8756cbc71150e' 
  AND (
    token = 'Lg+KSzlI/QvR1GRjlkXQObMzPXEb2GNfxp+EiZ7Pbuw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049