UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hKe/H5KJ27yp25hu/L/uTxIOsgK8uEWbfQaVwvkaiks=' 
WHERE 
  key_id = '105d6700d1a01b9e2fde6ac28b430d8443b03762cd233a495e1e07791bea86ae' 
  AND (
    token = 'hKe/H5KJ27yp25hu/L/uTxIOsgK8uEWbfQaVwvkaiks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046