UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aZKJBRvtF/xFmA2ZzVG5iUiZR3aYqsYCtQFaK1w2lNU=' 
WHERE 
  key_id = '59ab1464b9c07a7fe792f30928b750636cd967a243fd9774b25fad5ebfd25da1' 
  AND (
    token = 'aZKJBRvtF/xFmA2ZzVG5iUiZR3aYqsYCtQFaK1w2lNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038