UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DkIvZXrugH+csfTYRS0gg1SAnBNYxkK6mN2qXCNn75c=' 
WHERE 
  key_id = '229ee7601b921ae610e7f954464a1262ba51371f27a415ea6712833f6a02bed8' 
  AND (
    token = 'DkIvZXrugH+csfTYRS0gg1SAnBNYxkK6mN2qXCNn75c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031