UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1N1A/n9TBIrJm86wpCG2YSg8ClVngjgnw2D+0loYpdE=' 
WHERE 
  key_id = '416b9b527e31bb306fedeb24cb4437ffad3cfc398f54bac26e5be6ee93b24b56' 
  AND (
    token = '1N1A/n9TBIrJm86wpCG2YSg8ClVngjgnw2D+0loYpdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021