UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ur46rQcEmU+M9UucxP6hirLZXVO2+rFb14fZfMzSXU4=' 
WHERE 
  key_id = '8db451ffde317158526e1f03e479596384cd64f4b24af53f01383afb294f95aa' 
  AND (
    token = 'Ur46rQcEmU+M9UucxP6hirLZXVO2+rFb14fZfMzSXU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032