UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N8MoK7sY0iiN5+LouM7QwpfD3XdwCK9UBxR3sr3Zlts=' 
WHERE 
  key_id = '36f1bc0e12d5e82040b49ca2d431a20c7421c286c03629c5498ceb10e7c07abc' 
  AND (
    token = 'N8MoK7sY0iiN5+LouM7QwpfD3XdwCK9UBxR3sr3Zlts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052