UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qN1ueqTcAhPMtJE3bq6ikuC1p0XQMXF84LlH0+FUHPc=' 
WHERE 
  key_id = '2445545dd613988db28a244557dc047bae41d0468464852b768feeab40789769' 
  AND (
    token = 'qN1ueqTcAhPMtJE3bq6ikuC1p0XQMXF84LlH0+FUHPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051